<?php

use Yaf\Plugin_Abstract;
use Yaf\Request_Abstract;
use Yaf\Response_Abstract;

/**
 * 测试插件
 */
class TestPlugin extends Plugin_Abstract
{
    public function routerStartup(Request_Abstract $request, Response_Abstract $response)
    {
        /* 在路由之前执行,这个钩子里，你可以做url重写等功能 */
        var_dump("routerStartup");
    }

    public function routerShutdown(Request_Abstract $request, Response_Abstract $response)
    {
        /* 路由完成后，在这个钩子里，你可以做登陆检测等功能*/
        var_dump("routerShutdown");
    }

    public function dispatchLoopStartup(Request_Abstract $request, Response_Abstract $response)
    {
        var_dump("dispatchLoopStartup");
    }

    public function preDispatch(Request_Abstract $request, Response_Abstract $response)
    {
        var_dump("preDispatch");
    }

    public function postDispatch(Request_Abstract $request, Response_Abstract $response)
    {
        var_dump("postDispatch");
    }

    public function dispatchLoopShutdown(Request_Abstract $request, Response_Abstract $response)
    {
        /* final hook
           in this hook user can do logging or implement layout */
        var_dump("dispatchLoopShutdown");
    }
}